<?php
/**
 * Smart Library - Smart Framework
 * http://smart-framework.highet.eu
 *
 * @category   SmartL
 * @package    SmartL_Application
 * @subpackage Plugin
 * @copyright  Copyright (c) 2005-2008 Smart Framework team - Stepan Sindelar, Vojtech Vit
 * @license    http://www.opensource.org/licenses/bsd-license.php	New BSD License
 */

/**
 * @see Zend_Controller_Plugin_Abstract
 */
require_once 'Zend/Controller/Plugin/Abstract.php';

/**
 * SmartL Front Controller MVC helper plugin. In each application run phase it 
 * calls corresponding methods of SmartL_Application class. 
 * 
 * @package SmartL_Application
 * @subpackage Plugin
 */
class SmartL_Application_Plugin_InitFramework extends Zend_Controller_Plugin_Abstract {
	
	/**
	 * Instance of SmartL_Application class.
	 * 
	 * @var SmartL_Application
	 */
	protected $_app = null;
	
	/**
	 * Plugin class constructor. It gaines an instance of SmartL_Application
	 * class and stores it in private variable. 
	 *
	 */
	public function __construct() {
		//parent::__construct();
		$this->_app = SmartL_Application::getInstance ();
	}
	/**
	 * Application run phase before "Routing".
	 *
	 * @param Zend_Controller_Request_Abstract $request
	 */
	public function routeStartup(Zend_Controller_Request_Abstract $request) {
		$this->_app->routeStartup ( $request );
	}
	/**
	 * Application run phase just after the "Routing".
	 *
	 * @param Zend_Controller_Request_Abstract $request
	 */
	public function routeShutdown(Zend_Controller_Request_Abstract $request) {
		$this->_app->routeShutdown ( $request );
	}
	/**
	 * Application run phase before the "DispatchLoop".
	 *
	 * @param Zend_Controller_Request_Abstract $request
	 */
	public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) {
		$this->_app->dispatchLoopStartup ( $request );
	}
	/**
	 * Application run phase before "Dispatch" of each action in "action stack".
	 *
	 * @param Zend_Controller_Request_Abstract $request
	 */
	public function preDispatch(Zend_Controller_Request_Abstract $request) {
		$this->_app->preDispatch ( $request );
	}
	/**
	 * Application run phase just after "Dispatch" of each action in "action stack".
	 *
	 * @param Zend_Controller_Request_Abstract $request
	 */
	public function postDispatch(Zend_Controller_Request_Abstract $request) {
		$this->_app->postDispatch ( $request );
	}
	/**
	 * Application run phase just after the "DispatchLoop".
	 *
	 * @param Zend_Controller_Request_Abstract $request
	 */
	public function dispatchLoopShutdown() {
		$this->_app->dispatchLoopShutdown ();
	}
}